package cn.tedu;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class Demo09 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入用户名: ");
        String username = scan.nextLine();
        System.out.println("请输入密码: ");
        String password = scan.nextLine();
        System.out.println("请输入昵称");
        String nick = scan.nextLine();

        try (Connection conn = DBUtils.getConn();) {
            Statement s = conn.createStatement();
            int a = s.executeUpdate("insert into user(username,password,nick) values('"+username+"','"+password+"','"+nick+"')");
            System.out.println("创建成功!"+a);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}
